package inherit;

public class DogDemo {
    public static void main(String[] args) {
        Husky h = new Husky();
        h.drink();
        h.watchHome();
        h.eat();
        GoldenRetriever g = new GoldenRetriever();
        g.drink();
        g.watchHome();
        g.eat();
    }
}
class Dog {
    public void watchHome(){
        System.out.println("看家");
    }
    public void eat(){
        System.out.println("吃骨头");
    }
    public void drink(){
        System.out.println("喝水");
    }
}

class Husky extends Dog{
    @Override
    public void eat(){
        System.out.println("吃狗粮和骨头");
    }
}

class GoldenRetriever extends Dog{
    @Override
    public void eat(){
        System.out.println("吃剩饭");
    }
}
